using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using System.Xml;
using ICSharpCode.TextEditor.Actions;
using ICSharpCode.TextEditor.Document;
using ICSharpCode.TextEditor.Properties;
using ICSharpCode.TextEditor.Src.Document.FoldingStrategy;
using ICSharpCode.TextEditor.UserControls;

namespace ICSharpCode.TextEditor
{
	public class TextEditorToolBar : TextEditorControlEx
	{
		private const string _PropertySavePath = "XmlEditor.TextEditorControl.{0}";

		private const string SharpPadFileFilter = "Xml Files (*.xml)|*.xml|All Files (*.*)|*.*";

		private string _xnOriginalXml;

		private bool _isEditPad = false;

		private ITextEditorProperties _editorSettings;

		private FindAndReplaceForm _findForm = new FindAndReplaceForm();

		private IContainer components = null;

		private MenuStrip menuStrip;

		private ToolStripMenuItem miFile;

		private ToolStripMenuItem miOpenFile;

		private ToolStripMenuItem miSave;

		private ToolStripMenuItem miSaveAs;

		private ToolStripSeparator toolStripMenuItem1;

		private ToolStripMenuItem miExit;

		private ToolStripMenuItem miEdit;

		private ToolStripMenuItem miEditCut;

		private ToolStripMenuItem miEditCopy;

		private ToolStripMenuItem miEditPaste;

		private ToolStripMenuItem miEditDelete;

		private ToolStripSeparator toolStripMenuItem2;

		private ToolStripMenuItem miEditFind;

		private ToolStripMenuItem miEditReplace;

		private ToolStripMenuItem miEditFindNext;

		private ToolStripMenuItem miEditFindPrev;

		private ToolStripSeparator toolStripMenuItem3;

		private ToolStripMenuItem miToggleBookmark;

		private ToolStripMenuItem miGoToNextBookmark;

		private ToolStripMenuItem miGoToPrevBookmark;

		private ToolStripMenuItem miOption;

		private ToolStripMenuItem miSplitWindow;

		private ToolStripMenuItem miShowSpacesTabs;

		private ToolStripMenuItem miShowEOLMarkers;

		private ToolStripMenuItem miShowInvalidLines;

		private ToolStripMenuItem miShowLineNumbers;

		private ToolStripMenuItem miHLCurRow;

		private ToolStripMenuItem miBracketMatchingStyle;

		private ToolStripMenuItem miEnableVirtualSpace;

		private ToolStripSeparator toolStripMenuItem4;

		private ToolStripMenuItem miConvertTabsToSpaces;

		private ToolStripMenuItem miSetTabSize;

		private ToolStripMenuItem miSetFont;

		private ToolStripMenuItem miMenuXml;

		private ToolStripMenuItem miViewMode;

		private ToolStripSeparator toolStripMenuItem6;

		private ToolStripMenuItem miFormatXml;

		private TextEditorControlEx textEditorControlEx1;

		private FontDialog fontDialog;

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public Func<bool> BtnSaveHandler { get; set; }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public string OriginalXml
		{
			get
			{
				return this._xnOriginalXml;
			}
			set
			{
				this._xnOriginalXml = value;
			}
		}

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public string TextContent { get; set; }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public bool IsEditPad
		{
			get
			{
				return this._isEditPad;
			}
			set
			{
				this._isEditPad = value;
			}
		}

		private TextEditorControlEx ActiveEditor => this;

		[Category("Appearance")]
		[DefaultValue(false)]
		[Description("工具栏格式按钮显示")]
		[Browsable(true)]
		public bool IsFormatVisible
		{
			get
			{
				return this.miMenuXml.Visible;
			}
			set
			{
				this.miMenuXml.Visible = value;
			}
		}

		public TextEditorToolBar()
		{
			this.InitializeComponent();
			this.miMenuXml.Visible = this.IsFormatVisible;
			this.InitForm();
		}

		public void FormatXml(string xml)
		{
			string text = this.IndentedFormat(TextEditorToolBar.SimpleFormat(this.IndentedFormat(xml)));
			this.ActiveEditor.Document.Replace(0, this.ActiveEditor.Document.TextLength, text);
			this.UpdateFolding();
		}

		private void UpdateFolding()
		{
			this.ActiveEditor.Document.FoldingManager.UpdateFoldings(string.Empty, null);
			this.ActiveEditor.ActiveTextAreaControl.TextArea.Refresh();
		}

		private static string SimpleFormat(string xml)
		{
			return xml.Replace("><", ">\r\n<");
		}

		private string IndentedFormat(string xml)
		{
			string empty = string.Empty;
			try
			{
				XmlTextReader xmlTextReader = new XmlTextReader(new StringReader(xml));
				xmlTextReader.WhitespaceHandling = WhitespaceHandling.None;
				StringWriter stringWriter = new StringWriter();
				XmlTextWriter xmlTextWriter = this.CreateXmlTextWriter(stringWriter);
				xmlTextWriter.WriteNode(xmlTextReader, defattr: false);
				xmlTextWriter.Flush();
				return stringWriter.ToString();
			}
			catch (Exception)
			{
				return xml;
			}
		}

		private XmlTextWriter CreateXmlTextWriter(TextWriter textWriter)
		{
			XmlTextWriter xmlTextWriter = new XmlTextWriter(textWriter);
			if (this.ActiveEditor.TextEditorProperties.ConvertTabsToSpaces)
			{
				xmlTextWriter.Indentation = this.ActiveEditor.TextEditorProperties.IndentationSize;
				xmlTextWriter.IndentChar = ' ';
			}
			else
			{
				xmlTextWriter.Indentation = 1;
				xmlTextWriter.IndentChar = '\t';
			}
			xmlTextWriter.Formatting = Formatting.Indented;
			return xmlTextWriter;
		}

		private void InitForm()
		{
			IDictionary dictionary = new Dictionary<string, string>();
			Hashtable highlightingDefinitions = HighlightingManager.Manager.HighlightingDefinitions;
			foreach (object item in highlightingDefinitions)
			{
				DictionaryEntry dictionaryEntry = (DictionaryEntry)item;
				if (!dictionary.Contains(dictionaryEntry.Key))
				{
					dictionary.Add(dictionaryEntry.Key, dictionaryEntry.Key);
				}
			}
			foreach (string key in dictionary.Keys)
			{
				ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem();
				toolStripMenuItem.Name = "mi" + key;
				toolStripMenuItem.Text = key;
				toolStripMenuItem.Tag = dictionary[key];
				toolStripMenuItem.Click += delegate(object sender, EventArgs e)
				{
					ToolStripMenuItem toolStripMenuItem2 = sender as ToolStripMenuItem;
					if (toolStripMenuItem2 != null && toolStripMenuItem2.Tag != null)
					{
						ToolStripDropDownMenu toolStripDropDownMenu = toolStripMenuItem2.Owner as ToolStripDropDownMenu;
						if (toolStripDropDownMenu != null && toolStripDropDownMenu.Items.Count > 0)
						{
							foreach (ToolStripMenuItem item2 in toolStripDropDownMenu.Items)
							{
								item2.Checked = false;
							}
							toolStripMenuItem2.Checked = true;
						}
						if (this.ActiveEditor != null)
						{
							this.ActiveEditor.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(toolStripMenuItem2.Tag as string);
						}
					}
				};
				if (key == "XML")
				{
					toolStripMenuItem.Checked = true;
					this.ActiveEditor.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy("XML");
				}
				this.miViewMode.DropDownItems.Add(toolStripMenuItem);
			}
			if (this._editorSettings == null)
			{
				this._editorSettings = this.ActiveEditor.TextEditorProperties;
				this.OnSettingsChanged();
			}
			else
			{
				this.ActiveEditor.TextEditorProperties = this._editorSettings;
			}
			if (!(this.ActiveEditor.Document.FoldingManager.FoldingStrategy is XmlFoldingStrategy))
			{
				this.ActiveEditor.Document.FoldingManager.FoldingStrategy = new XmlFoldingStrategy();
			}
			this.UpdateFolding();
		}

		private void miExit_Click(object sender, EventArgs e)
		{
		}

		private void miOpenFile_Click(object sender, EventArgs e)
		{
			TextEditorControl activeEditor = this.ActiveEditor;
			if (activeEditor == null)
			{
				return;
			}
			using OpenFileDialog openFileDialog = new OpenFileDialog();
			openFileDialog.FilterIndex = 0;
			if (DialogResult.OK != openFileDialog.ShowDialog())
			{
				return;
			}
			activeEditor.LoadFile(openFileDialog.FileName);
			this.CheckCurrentViewMode(activeEditor.Document.HighlightingStrategy.Name);
			if (Path.GetExtension(openFileDialog.FileName)!.ToLower() == ".xml")
			{
				if (!(this.ActiveEditor.Document.FoldingManager.FoldingStrategy is XmlFoldingStrategy))
				{
					this.ActiveEditor.Document.FoldingManager.FoldingStrategy = new XmlFoldingStrategy();
				}
				this.UpdateFolding();
			}
		}

		private void miSave_Click(object sender, EventArgs e)
		{
			Func<bool> btnSaveHandler = this.BtnSaveHandler;
			if (btnSaveHandler != null && !btnSaveHandler())
			{
				return;
			}
			TextEditorControl activeEditor = this.ActiveEditor;
			if (activeEditor != null)
			{
				if (activeEditor.FileName != null)
				{
					activeEditor.SaveFile(activeEditor.FileName);
				}
				else
				{
					this.SaveAs();
				}
			}
		}

		private void miSaveAs_Click(object sender, EventArgs e)
		{
			this.SaveAs();
		}

		private void SaveAs()
		{
			TextEditorControl activeEditor = this.ActiveEditor;
			if (activeEditor == null)
			{
				return;
			}
			using SaveFileDialog saveFileDialog = new SaveFileDialog();
			saveFileDialog.FilterIndex = 0;
			if (DialogResult.OK == saveFileDialog.ShowDialog())
			{
				activeEditor.SaveFile(saveFileDialog.FileName);
				activeEditor.FileName = saveFileDialog.FileName;
			}
		}

		private void miEditCut_Click(object sender, EventArgs e)
		{
			if (this.HaveSelection())
			{
				base.DoCut();
			}
		}

		private void miEditCopy_Click(object sender, EventArgs e)
		{
			if (this.HaveSelection())
			{
				base.DoCopy();
			}
		}

		private void miEditPaste_Click(object sender, EventArgs e)
		{
			base.DoPaste();
		}

		private void miEditDelete_Click(object sender, EventArgs e)
		{
			if (this.HaveSelection())
			{
				base.DoDelete();
			}
		}

		private void miEditFind_Click(object sender, EventArgs e)
		{
			TextEditorControl activeEditor = this.ActiveEditor;
			if (activeEditor != null)
			{
				this._findForm.ShowFor(activeEditor, replaceMode: false);
			}
		}

		private void miEditReplace_Click(object sender, EventArgs e)
		{
			TextEditorControl activeEditor = this.ActiveEditor;
			if (activeEditor != null)
			{
				this._findForm.ShowFor(activeEditor, replaceMode: true);
			}
		}

		private void miEditFindNext_Click(object sender, EventArgs e)
		{
			this._findForm.FindNext(viaF3: true, searchBackward: false, string.Format("没有找到你要查找的内容！", this._findForm.LookFor));
		}

		private void miEditFindPrev_Click(object sender, EventArgs e)
		{
			this._findForm.FindNext(viaF3: true, searchBackward: true, string.Format("没有找到你要查找的内容！", this._findForm.LookFor));
		}

		private void miToggleBookmark_Click(object sender, EventArgs e)
		{
			TextEditorControl activeEditor = this.ActiveEditor;
			if (activeEditor != null)
			{
				this.DoEditAction(this.ActiveEditor, new ToggleBookmark());
				activeEditor.IsIconBarVisible = activeEditor.Document.BookmarkManager.Marks.Count > 0;
			}
		}

		private void miGoToNextBookmark_Click(object sender, EventArgs e)
		{
			this.DoEditAction(this.ActiveEditor, new GotoNextBookmark((Bookmark bookmark) => true));
		}

		private void miGoToPrevBookmark_Click(object sender, EventArgs e)
		{
			this.DoEditAction(this.ActiveEditor, new GotoPrevBookmark((Bookmark bookmark) => true));
		}

		private void miFormatXml_Click(object sender, EventArgs e)
		{
			try
			{
				this.FormatXml(this.ActiveEditor.Document.TextContent);
			}
			catch (Exception ex)
			{
				MessageBox.Show($"Xml格式化失败：{ex.ToString()}");
			}
		}

		private void miSplitWindow_Click(object sender, EventArgs e)
		{
			TextEditorControl activeEditor = this.ActiveEditor;
			if (activeEditor != null)
			{
				activeEditor.Split();
				this.OnSettingsChanged();
			}
		}

		private void OnSettingsChanged()
		{
			this.miSplitWindow.Checked = this.ActiveEditor.IsSplited;
			this.miShowSpacesTabs.Checked = this._editorSettings.ShowSpaces;
			this.miShowEOLMarkers.Checked = this._editorSettings.ShowEOLMarker;
			this.miShowInvalidLines.Checked = this._editorSettings.ShowInvalidLines;
			this.miHLCurRow.Checked = this._editorSettings.LineViewerStyle == LineViewerStyle.FullRow;
			this.miBracketMatchingStyle.Checked = this._editorSettings.BracketMatchingStyle == BracketMatchingStyle.After;
			this.miEnableVirtualSpace.Checked = this._editorSettings.AllowCaretBeyondEOL;
			this.miShowLineNumbers.Checked = this._editorSettings.ShowLineNumbers;
			this.miConvertTabsToSpaces.Checked = this.ActiveEditor.ConvertTabsToSpaces;
		}

		private void miShowSpacesTabs_Click(object sender, EventArgs e)
		{
			TextEditorControl activeEditor = this.ActiveEditor;
			if (activeEditor != null)
			{
				bool showSpaces = (activeEditor.ShowTabs = !activeEditor.ShowSpaces);
				activeEditor.ShowSpaces = showSpaces;
				this.OnSettingsChanged();
			}
		}

		private void miShowEOLMarkers_Click(object sender, EventArgs e)
		{
			TextEditorControl activeEditor = this.ActiveEditor;
			if (activeEditor != null)
			{
				activeEditor.ShowEOLMarkers = !activeEditor.ShowEOLMarkers;
				this.OnSettingsChanged();
			}
		}

		private void miShowInvalidLines_Click(object sender, EventArgs e)
		{
			TextEditorControl activeEditor = this.ActiveEditor;
			if (activeEditor != null)
			{
				activeEditor.ShowInvalidLines = !activeEditor.ShowInvalidLines;
				this.OnSettingsChanged();
			}
		}

		private void miShowLineNumbers_Click(object sender, EventArgs e)
		{
			TextEditorControl activeEditor = this.ActiveEditor;
			if (activeEditor != null)
			{
				activeEditor.ShowLineNumbers = !activeEditor.ShowLineNumbers;
				this.OnSettingsChanged();
			}
		}

		private void miHLCurRow_Click(object sender, EventArgs e)
		{
			TextEditorControl activeEditor = this.ActiveEditor;
			if (activeEditor != null)
			{
				activeEditor.LineViewerStyle = ((activeEditor.LineViewerStyle == LineViewerStyle.None) ? LineViewerStyle.FullRow : LineViewerStyle.None);
				this.OnSettingsChanged();
			}
		}

		private void miBracketMatchingStyle_Click(object sender, EventArgs e)
		{
			TextEditorControl activeEditor = this.ActiveEditor;
			if (activeEditor != null)
			{
				activeEditor.BracketMatchingStyle = ((activeEditor.BracketMatchingStyle != BracketMatchingStyle.After) ? BracketMatchingStyle.After : BracketMatchingStyle.Before);
				this.OnSettingsChanged();
			}
		}

		private void miEnableVirtualSpace_Click(object sender, EventArgs e)
		{
			TextEditorControl activeEditor = this.ActiveEditor;
			if (activeEditor != null)
			{
				activeEditor.AllowCaretBeyondEOL = !activeEditor.AllowCaretBeyondEOL;
				this.OnSettingsChanged();
			}
		}

		private void miConvertTabsToSpaces_Click(object sender, EventArgs e)
		{
			TextEditorControl activeEditor = this.ActiveEditor;
			if (activeEditor != null)
			{
				activeEditor.ConvertTabsToSpaces = !activeEditor.ConvertTabsToSpaces;
				this.OnSettingsChanged();
			}
		}

		private void miSetTabSize_Click(object sender, EventArgs e)
		{
			if (this.ActiveEditor != null)
			{
				string text = InputBox.Show("请指定制表符大小：", "制表符大小", this._editorSettings.TabIndent.ToString());
				if (text != null && int.TryParse(text, out var result) && Globals.IsInRange(result, 1, 32))
				{
					this.ActiveEditor.TabIndent = result;
				}
			}
		}

		private void miSetFont_Click(object sender, EventArgs e)
		{
			TextEditorControl activeEditor = this.ActiveEditor;
			if (activeEditor != null)
			{
				this.fontDialog.Font = activeEditor.Font;
				if (this.fontDialog.ShowDialog(this) == DialogResult.OK)
				{
					activeEditor.Font = this.fontDialog.Font;
					this.OnSettingsChanged();
				}
			}
		}

		private void DoEditAction(TextEditorControl editor, IEditAction action)
		{
			if (editor == null || action == null)
			{
				return;
			}
			TextArea textArea = editor.ActiveTextAreaControl.TextArea;
			editor.BeginUpdate();
			try
			{
				lock (editor.Document)
				{
					action.Execute(textArea);
					if (textArea.SelectionManager.HasSomethingSelected && textArea.AutoClearSelection && textArea.Document.TextEditorProperties.DocumentSelectionMode == DocumentSelectionMode.Normal)
					{
						textArea.SelectionManager.ClearSelection();
					}
				}
			}
			finally
			{
				editor.EndUpdate();
				textArea.Caret.UpdateCaretPosition();
			}
		}

		private bool HaveSelection()
		{
			return this.ActiveEditor?.ActiveTextAreaControl.TextArea.SelectionManager.HasSomethingSelected ?? false;
		}

		private void CheckCurrentViewMode(string modeName)
		{
			TextEditorControl activeEditor = this.ActiveEditor;
			if (activeEditor == null || activeEditor.Document.HighlightingStrategy == null || this.miViewMode.DropDownItems.Count <= 0)
			{
				return;
			}
			foreach (ToolStripMenuItem dropDownItem in this.miViewMode.DropDownItems)
			{
				if (dropDownItem.Tag != null && dropDownItem.Tag.ToString()!.Equals(modeName, StringComparison.OrdinalIgnoreCase))
				{
					dropDownItem.Checked = true;
				}
				else
				{
					dropDownItem.Checked = false;
				}
			}
		}

		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}

		private void InitializeComponent()
		{
			this.menuStrip = new System.Windows.Forms.MenuStrip();
			this.miFile = new System.Windows.Forms.ToolStripMenuItem();
			this.miOpenFile = new System.Windows.Forms.ToolStripMenuItem();
			this.miSave = new System.Windows.Forms.ToolStripMenuItem();
			this.miSaveAs = new System.Windows.Forms.ToolStripMenuItem();
			this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
			this.miExit = new System.Windows.Forms.ToolStripMenuItem();
			this.miEdit = new System.Windows.Forms.ToolStripMenuItem();
			this.miEditCut = new System.Windows.Forms.ToolStripMenuItem();
			this.miEditCopy = new System.Windows.Forms.ToolStripMenuItem();
			this.miEditPaste = new System.Windows.Forms.ToolStripMenuItem();
			this.miEditDelete = new System.Windows.Forms.ToolStripMenuItem();
			this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
			this.miEditFind = new System.Windows.Forms.ToolStripMenuItem();
			this.miEditReplace = new System.Windows.Forms.ToolStripMenuItem();
			this.miEditFindNext = new System.Windows.Forms.ToolStripMenuItem();
			this.miEditFindPrev = new System.Windows.Forms.ToolStripMenuItem();
			this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
			this.miToggleBookmark = new System.Windows.Forms.ToolStripMenuItem();
			this.miGoToNextBookmark = new System.Windows.Forms.ToolStripMenuItem();
			this.miGoToPrevBookmark = new System.Windows.Forms.ToolStripMenuItem();
			this.miOption = new System.Windows.Forms.ToolStripMenuItem();
			this.miSplitWindow = new System.Windows.Forms.ToolStripMenuItem();
			this.miShowSpacesTabs = new System.Windows.Forms.ToolStripMenuItem();
			this.miShowEOLMarkers = new System.Windows.Forms.ToolStripMenuItem();
			this.miShowInvalidLines = new System.Windows.Forms.ToolStripMenuItem();
			this.miShowLineNumbers = new System.Windows.Forms.ToolStripMenuItem();
			this.miHLCurRow = new System.Windows.Forms.ToolStripMenuItem();
			this.miBracketMatchingStyle = new System.Windows.Forms.ToolStripMenuItem();
			this.miEnableVirtualSpace = new System.Windows.Forms.ToolStripMenuItem();
			this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator();
			this.miConvertTabsToSpaces = new System.Windows.Forms.ToolStripMenuItem();
			this.miSetTabSize = new System.Windows.Forms.ToolStripMenuItem();
			this.miSetFont = new System.Windows.Forms.ToolStripMenuItem();
			this.miMenuXml = new System.Windows.Forms.ToolStripMenuItem();
			this.miViewMode = new System.Windows.Forms.ToolStripMenuItem();
			this.toolStripMenuItem6 = new System.Windows.Forms.ToolStripSeparator();
			this.miFormatXml = new System.Windows.Forms.ToolStripMenuItem();
			this.fontDialog = new System.Windows.Forms.FontDialog();
			this.textEditorControlEx1 = new ICSharpCode.TextEditor.TextEditorControlEx();
			this.menuStrip.SuspendLayout();
			base.SuspendLayout();
			base.textAreaPanel.Location = new System.Drawing.Point(0, 25);
			base.textAreaPanel.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
			base.textAreaPanel.Size = new System.Drawing.Size(776, 443);
			this.menuStrip.BackColor = System.Drawing.SystemColors.Control;
			this.menuStrip.Font = new System.Drawing.Font("宋体", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
			this.menuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
			this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[4] { this.miFile, this.miEdit, this.miOption, this.miMenuXml });
			this.menuStrip.Location = new System.Drawing.Point(0, 0);
			this.menuStrip.Name = "menuStrip";
			this.menuStrip.Padding = new System.Windows.Forms.Padding(5, 3, 0, 3);
			this.menuStrip.Size = new System.Drawing.Size(776, 25);
			this.menuStrip.TabIndex = 1;
			this.menuStrip.Text = "menuStrip";
			this.miFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[5] { this.miOpenFile, this.miSave, this.miSaveAs, this.toolStripMenuItem1, this.miExit });
			this.miFile.Name = "miFile";
			this.miFile.Size = new System.Drawing.Size(59, 19);
			this.miFile.Text = "文件(&F)";
			this.miOpenFile.Image = ICSharpCode.TextEditor.Properties.Resources.miOpenFile_Image;
			this.miOpenFile.Name = "miOpenFile";
			this.miOpenFile.ShortcutKeys = System.Windows.Forms.Keys.O | System.Windows.Forms.Keys.Control;
			this.miOpenFile.Size = new System.Drawing.Size(184, 26);
			this.miOpenFile.Text = "打开(&O)...";
			this.miOpenFile.Click += new System.EventHandler(miOpenFile_Click);
			this.miSave.Image = ICSharpCode.TextEditor.Properties.Resources.miSave_Image;
			this.miSave.Name = "miSave";
			this.miSave.ShortcutKeys = System.Windows.Forms.Keys.S | System.Windows.Forms.Keys.Control;
			this.miSave.Size = new System.Drawing.Size(184, 26);
			this.miSave.Text = "保存(&S)";
			this.miSave.Click += new System.EventHandler(miSave_Click);
			this.miSaveAs.Name = "miSaveAs";
			this.miSaveAs.Size = new System.Drawing.Size(184, 26);
			this.miSaveAs.Text = "另存为(&A)...";
			this.miSaveAs.Click += new System.EventHandler(miSaveAs_Click);
			this.toolStripMenuItem1.Name = "toolStripMenuItem1";
			this.toolStripMenuItem1.Size = new System.Drawing.Size(181, 6);
			this.toolStripMenuItem1.Visible = false;
			this.miExit.Name = "miExit";
			this.miExit.Size = new System.Drawing.Size(184, 26);
			this.miExit.Text = "退出(&X)";
			this.miExit.Visible = false;
			this.miExit.Click += new System.EventHandler(miExit_Click);
			this.miEdit.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[13]
			{
				this.miEditCut, this.miEditCopy, this.miEditPaste, this.miEditDelete, this.toolStripMenuItem2, this.miEditFind, this.miEditReplace, this.miEditFindNext, this.miEditFindPrev, this.toolStripMenuItem3,
				this.miToggleBookmark, this.miGoToNextBookmark, this.miGoToPrevBookmark
			});
			this.miEdit.Name = "miEdit";
			this.miEdit.Size = new System.Drawing.Size(59, 19);
			this.miEdit.Text = "编辑(&E)";
			this.miEditCut.Image = ICSharpCode.TextEditor.Properties.Resources.miEditCut_Image;
			this.miEditCut.Name = "miEditCut";
			this.miEditCut.ShortcutKeys = System.Windows.Forms.Keys.X | System.Windows.Forms.Keys.Control;
			this.miEditCut.Size = new System.Drawing.Size(205, 26);
			this.miEditCut.Text = "剪切(&X)";
			this.miEditCut.Click += new System.EventHandler(miEditCut_Click);
			this.miEditCopy.Image = ICSharpCode.TextEditor.Properties.Resources.miEditCopy_Image;
			this.miEditCopy.Name = "miEditCopy";
			this.miEditCopy.Size = new System.Drawing.Size(205, 26);
			this.miEditCopy.Text = "复制(&C)";
			this.miEditCopy.Click += new System.EventHandler(miEditCopy_Click);
			this.miEditPaste.Image = ICSharpCode.TextEditor.Properties.Resources.miEditPaste_Image;
			this.miEditPaste.Name = "miEditPaste";
			this.miEditPaste.Size = new System.Drawing.Size(205, 26);
			this.miEditPaste.Text = "粘贴(&V)";
			this.miEditPaste.Click += new System.EventHandler(miEditPaste_Click);
			this.miEditDelete.Image = ICSharpCode.TextEditor.Properties.Resources.miEditDelete_Image;
			this.miEditDelete.Name = "miEditDelete";
			this.miEditDelete.Size = new System.Drawing.Size(205, 26);
			this.miEditDelete.Text = "删除(&D)";
			this.miEditDelete.Click += new System.EventHandler(miEditDelete_Click);
			this.toolStripMenuItem2.Name = "toolStripMenuItem2";
			this.toolStripMenuItem2.Size = new System.Drawing.Size(202, 6);
			this.miEditFind.Image = ICSharpCode.TextEditor.Properties.Resources.miEditFind_Image;
			this.miEditFind.Name = "miEditFind";
			this.miEditFind.ShortcutKeys = System.Windows.Forms.Keys.F | System.Windows.Forms.Keys.Control;
			this.miEditFind.Size = new System.Drawing.Size(205, 26);
			this.miEditFind.Text = "查找(&F)...";
			this.miEditFind.Click += new System.EventHandler(miEditFind_Click);
			this.miEditReplace.Name = "miEditReplace";
			this.miEditReplace.ShortcutKeys = System.Windows.Forms.Keys.H | System.Windows.Forms.Keys.Control;
			this.miEditReplace.Size = new System.Drawing.Size(205, 26);
			this.miEditReplace.Text = "替换(&R)...";
			this.miEditReplace.Click += new System.EventHandler(miEditReplace_Click);
			this.miEditFindNext.Image = ICSharpCode.TextEditor.Properties.Resources.miEditFindNext_Image;
			this.miEditFindNext.Name = "miEditFindNext";
			this.miEditFindNext.ShortcutKeys = System.Windows.Forms.Keys.F3;
			this.miEditFindNext.Size = new System.Drawing.Size(205, 26);
			this.miEditFindNext.Text = "查找下一个(&N)";
			this.miEditFindNext.Click += new System.EventHandler(miEditFindNext_Click);
			this.miEditFindPrev.Name = "miEditFindPrev";
			this.miEditFindPrev.ShortcutKeys = System.Windows.Forms.Keys.F3 | System.Windows.Forms.Keys.Shift;
			this.miEditFindPrev.Size = new System.Drawing.Size(205, 26);
			this.miEditFindPrev.Text = "查找上一个(&P)";
			this.miEditFindPrev.Click += new System.EventHandler(miEditFindPrev_Click);
			this.toolStripMenuItem3.Name = "toolStripMenuItem3";
			this.toolStripMenuItem3.Size = new System.Drawing.Size(202, 6);
			this.miToggleBookmark.Name = "miToggleBookmark";
			this.miToggleBookmark.ShortcutKeys = System.Windows.Forms.Keys.F2 | System.Windows.Forms.Keys.Control;
			this.miToggleBookmark.Size = new System.Drawing.Size(205, 26);
			this.miToggleBookmark.Text = "设置/取消书签";
			this.miToggleBookmark.Click += new System.EventHandler(miToggleBookmark_Click);
			this.miGoToNextBookmark.Name = "miGoToNextBookmark";
			this.miGoToNextBookmark.ShortcutKeys = System.Windows.Forms.Keys.F2;
			this.miGoToNextBookmark.Size = new System.Drawing.Size(205, 26);
			this.miGoToNextBookmark.Text = "转到下一书签";
			this.miGoToNextBookmark.Click += new System.EventHandler(miGoToNextBookmark_Click);
			this.miGoToPrevBookmark.Name = "miGoToPrevBookmark";
			this.miGoToPrevBookmark.ShortcutKeys = System.Windows.Forms.Keys.F2 | System.Windows.Forms.Keys.Alt;
			this.miGoToPrevBookmark.Size = new System.Drawing.Size(205, 26);
			this.miGoToPrevBookmark.Text = "转到前一书签";
			this.miGoToPrevBookmark.Click += new System.EventHandler(miGoToPrevBookmark_Click);
			this.miOption.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[12]
			{
				this.miSplitWindow, this.miShowSpacesTabs, this.miShowEOLMarkers, this.miShowInvalidLines, this.miShowLineNumbers, this.miHLCurRow, this.miBracketMatchingStyle, this.miEnableVirtualSpace, this.toolStripMenuItem4, this.miConvertTabsToSpaces,
				this.miSetTabSize, this.miSetFont
			});
			this.miOption.Name = "miOption";
			this.miOption.Size = new System.Drawing.Size(59, 19);
			this.miOption.Text = "选项(&O)";
			this.miSplitWindow.Image = ICSharpCode.TextEditor.Properties.Resources.miSplitWindow_Image;
			this.miSplitWindow.Name = "miSplitWindow";
			this.miSplitWindow.Size = new System.Drawing.Size(248, 26);
			this.miSplitWindow.Text = "拆分窗口(&W)";
			this.miSplitWindow.Click += new System.EventHandler(miSplitWindow_Click);
			this.miShowSpacesTabs.Name = "miShowSpacesTabs";
			this.miShowSpacesTabs.Size = new System.Drawing.Size(248, 26);
			this.miShowSpacesTabs.Text = "显示空格和制表符(&S)";
			this.miShowSpacesTabs.Click += new System.EventHandler(miShowSpacesTabs_Click);
			this.miShowEOLMarkers.Name = "miShowEOLMarkers";
			this.miShowEOLMarkers.Size = new System.Drawing.Size(248, 26);
			this.miShowEOLMarkers.Text = "显示换行标记(&E)";
			this.miShowEOLMarkers.Click += new System.EventHandler(miShowEOLMarkers_Click);
			this.miShowInvalidLines.Name = "miShowInvalidLines";
			this.miShowInvalidLines.Size = new System.Drawing.Size(248, 26);
			this.miShowInvalidLines.Text = "显示无效行标记(&I)";
			this.miShowInvalidLines.Click += new System.EventHandler(miShowInvalidLines_Click);
			this.miShowLineNumbers.Name = "miShowLineNumbers";
			this.miShowLineNumbers.Size = new System.Drawing.Size(248, 26);
			this.miShowLineNumbers.Text = "显示行号(&L)";
			this.miShowLineNumbers.Click += new System.EventHandler(miShowLineNumbers_Click);
			this.miHLCurRow.Image = ICSharpCode.TextEditor.Properties.Resources.miHLCurRow_Image;
			this.miHLCurRow.Name = "miHLCurRow";
			this.miHLCurRow.Size = new System.Drawing.Size(248, 26);
			this.miHLCurRow.Text = "高亮当前行(&H)";
			this.miHLCurRow.Click += new System.EventHandler(miHLCurRow_Click);
			this.miBracketMatchingStyle.Name = "miBracketMatchingStyle";
			this.miBracketMatchingStyle.Size = new System.Drawing.Size(248, 26);
			this.miBracketMatchingStyle.Text = "高亮匹配括号当光标在其后时(&A)";
			this.miBracketMatchingStyle.Visible = false;
			this.miBracketMatchingStyle.Click += new System.EventHandler(miBracketMatchingStyle_Click);
			this.miEnableVirtualSpace.Name = "miEnableVirtualSpace";
			this.miEnableVirtualSpace.Size = new System.Drawing.Size(248, 26);
			this.miEnableVirtualSpace.Text = "启用虚空格(&V)";
			this.miEnableVirtualSpace.Click += new System.EventHandler(miEnableVirtualSpace_Click);
			this.toolStripMenuItem4.Name = "toolStripMenuItem4";
			this.toolStripMenuItem4.Size = new System.Drawing.Size(245, 6);
			this.miConvertTabsToSpaces.Name = "miConvertTabsToSpaces";
			this.miConvertTabsToSpaces.Size = new System.Drawing.Size(248, 26);
			this.miConvertTabsToSpaces.Text = "制表符转换为空格(&C)";
			this.miConvertTabsToSpaces.Click += new System.EventHandler(miConvertTabsToSpaces_Click);
			this.miSetTabSize.Name = "miSetTabSize";
			this.miSetTabSize.Size = new System.Drawing.Size(248, 26);
			this.miSetTabSize.Text = "设置制表符大小(&T)";
			this.miSetTabSize.Click += new System.EventHandler(miSetTabSize_Click);
			this.miSetFont.Image = ICSharpCode.TextEditor.Properties.Resources.miSetFont_Image;
			this.miSetFont.Name = "miSetFont";
			this.miSetFont.Size = new System.Drawing.Size(248, 26);
			this.miSetFont.Text = "字体(&F)";
			this.miSetFont.Click += new System.EventHandler(miSetFont_Click);
			this.miMenuXml.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[3] { this.miViewMode, this.toolStripMenuItem6, this.miFormatXml });
			this.miMenuXml.Name = "miMenuXml";
			this.miMenuXml.Size = new System.Drawing.Size(59, 19);
			this.miMenuXml.Text = "格式(&X)";
			this.miViewMode.Name = "miViewMode";
			this.miViewMode.Size = new System.Drawing.Size(142, 22);
			this.miViewMode.Text = "查看方式(&M)";
			this.toolStripMenuItem6.Name = "toolStripMenuItem6";
			this.toolStripMenuItem6.Size = new System.Drawing.Size(139, 6);
			this.miFormatXml.Name = "miFormatXml";
			this.miFormatXml.Size = new System.Drawing.Size(142, 22);
			this.miFormatXml.Text = "Xml格式化(&F)";
			this.miFormatXml.Click += new System.EventHandler(miFormatXml_Click);
			this.textEditorControlEx1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.textEditorControlEx1.FoldingStrategy = "XML";
			this.textEditorControlEx1.Font = new System.Drawing.Font("Courier New", 10f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
			this.textEditorControlEx1.Location = new System.Drawing.Point(0, 25);
			this.textEditorControlEx1.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
			this.textEditorControlEx1.Name = "textEditorControlEx1";
			this.textEditorControlEx1.ShowVRuler = false;
			this.textEditorControlEx1.Size = new System.Drawing.Size(776, 443);
			this.textEditorControlEx1.SyntaxHighlighting = "XML";
			this.textEditorControlEx1.TabIndex = 2;
			this.textEditorControlEx1.Text = "textEditorControlEx1";
			base.AutoScaleDimensions = new System.Drawing.SizeF(7f, 17f);
			base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			base.Controls.Add(this.textEditorControlEx1);
			base.Controls.Add(this.menuStrip);
			base.FoldingStrategy = "CSharp";
			base.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
			base.Name = "TextEditorToolBar";
			base.Size = new System.Drawing.Size(776, 468);
			base.SyntaxHighlighting = "CSharp";
			base.Controls.SetChildIndex(this.menuStrip, 0);
			base.Controls.SetChildIndex(this.textEditorControlEx1, 0);
			base.Controls.SetChildIndex(base.textAreaPanel, 0);
			this.menuStrip.ResumeLayout(false);
			this.menuStrip.PerformLayout();
			base.ResumeLayout(false);
			base.PerformLayout();
		}
	}
}
